using System;
using System.ComponentModel.DataAnnotations.Schema;
using UwinEducation.Shared.Enums;


namespace UwinEducation.Domain.Entities
{
    /// <summary>
    /// 预约实体
    /// </summary>
    [Table("student_appointments")]
    public class Appointment : EntityBase
    {
        /// <summary>
        /// 预约ID
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public Guid OrderId{get;set;}

        /// <summary>
        /// 学生ID
        /// </summary>
        public Guid StudentId { get; set; }

        /// <summary>
        /// 教师ID
        /// </summary>
        public Guid TeacherId { get; set; }

        /// <summary>
        /// 预约状态
        /// </summary>
        public AppointmentStatus Status { get; set; }

        /// <summary>
        /// 预约截止时间
        /// </summary>
        public DateTime Deadline { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 金额
        /// </summary>
        public decimal? Amount { get; set; }

        /// <summary>
        /// 关联的学生
        /// </summary>
        public virtual Student Student { get; set; }

        /// <summary>
        /// 关联的教师
        /// </summary>
        public virtual Teacher Teacher { get; set; }

        /// <summary>
        /// 创建预约
        /// </summary>
        public static Appointment Create(
            Guid orderId,
            Guid studentId,
            Guid teacherId,
            DateTime deadline,
            decimal amount,
            string remarks = null)
        {
            return new Appointment
            {
                Id = Guid.NewGuid(),
                OrderId = orderId,
                StudentId = studentId,
                TeacherId = teacherId,
                Status = AppointmentStatus.Pending,
                Deadline = deadline,
                Remarks = remarks ?? string.Empty,
                Amount = amount,
                CreatedAt = DateTime.Now
            };
        }
    }
} 